using System;
using System.Collections.Generic;

namespace Kopernikus.Parsing.GenericLexing
{
    public enum LexDefaultAttributeOptions
    {
        AnySingleCharacter
    }

    [AttributeUsage(AttributeTargets.Method)]
    public class LexDefaultAttribute : Attribute
    {
        private readonly string[] m_literalTokens;

        public LexDefaultAttribute(LexDefaultAttributeOptions options)
        {
            switch (options)
            {
                case LexDefaultAttributeOptions.AnySingleCharacter:
                    m_literalTokens = null;
                    break;
                default:
                    throw new ArgumentOutOfRangeException("options");
            }
        }

        public LexDefaultAttribute(string literalToken, params string[] literalTokens)
        {
            List<string> l = new List<string>();
            l.Add(literalToken);
            l.AddRange(literalTokens);
            m_literalTokens = l.ToArray();
        }

        public string[] LiteralTerminals
        {
            get { return m_literalTokens; }
        }
    }
}